﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BUS;
using DAL;
using DTO;

namespace WEBSITE_BANDEAL.Admin
{
    public partial class KhacHang_List : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            lit_title.Text = "Quản lý khách hàng";
            lit_title_header.Text = "Danh sách khách hàng";
            if (!IsPostBack)
            {
                LoadData();
            }
        }

        private void LoadData()
        {
            KhachHangCollection dh = KHACH_HANGBUS.KhachHang_LayTatCaCSDL();
            Repeater1.DataSource = dh;
            Repeater1.DataBind();
        }

        protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {

            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                Literal lit_mail = (Literal)e.Item.FindControl("lit_mail");
                Literal lit_matkhau = (Literal)e.Item.FindControl("lit_matkhau");
                Literal lit_tenkhachhang = (Literal)e.Item.FindControl("lit_tenkhachhang");
                Literal lit_diachi = (Literal)e.Item.FindControl("lit_diachi");
                Literal lit_sodt = (Literal)e.Item.FindControl("lit_sodt");
                KHACH_HANG dh = (KHACH_HANG)e.Item.DataItem;
                lit_mail.Text = dh.Email;
               // lit_matkhau.Text = dh.MatKhau;
                //lit_tenkhachhang.Text = dh.TenKhachHang;
                lit_diachi.Text = dh.DiaChi;
                lit_sodt.Text = dh.DienThoai;

            }
        }
    }
}